
package interceptors;

import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.Interceptor;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.apache.struts2.ServletActionContext;


public class LoginCheckedInterceptor implements Interceptor {
    
    public LoginCheckedInterceptor() {
    }
    
    public void destroy() {
        
    }
    
    public void init() {
        
    }
    
    public String intercept(ActionInvocation actionInvocation) throws Exception {
        
        String result="success";
        
        HttpServletRequest request = ServletActionContext.getRequest();                
        HttpSession session=request.getSession();
        
        String url=request.getRequestURL().toString();        
        if(session.getAttribute("LoginName")==null)
        {
            result="false";
        }
        
        return result;
        
    }
    
}
